<%= form_for(@post,:html => { :multipart => true }) do |f| %>
  <% if @post.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>

      <ul>
        <% @post.errors.full_messages.each do |msg| %>
          <li><%= msg %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <div style="padding:5px;">
      <% if @post.category %>
        <%= f.label "大类" %>
        <%= select_tag "parent_id",parent_cate_list(@post.category.parent_id ||=@post.category.id),:id=>"parent_category"%>

        <%= f.label "小类" %>
        <select id="post_category_id" name="post[category_id]">
          <%=sub_cate_list(@post.category.id)%>
        </select>
      <%else%>
        <%= f.label "大类" %>
        <%= select_tag "parent_id",parent_cate_list(nil),:id=>"parent_category"%>

        <%= f.label "小类" %>
        <select id="post_category_id" name="post[category_id]">
          <%=sub_cate_list(nil)%>
        </select>
      <%end%>

      <%= f.label "工会小组" %>
      <%= f.select(:grade,grade_list,:include_blank=>"无") %>

      <%= f.label "所属科组" %>
      <%= f.select(:subject,subject_list,:include_blank=>"无") %>

      <%= f.label "所属团体" %>
      <%= f.select(:org_id,org_list,:include_blank=>"无") %>
    </div>
    <div style="padding:5px;">
      <%= f.label "允许评论" %>
      <%= f.select(:comment_status,comment_status_list) %>

      <%= f.label "状态" %>
      <%= f.select(:status,status_list) %>

      <%= f.label "访问权限" %>
      <%= f.select(:status,permit_list) %>

      <%= f.label :author,"作者" %>
      <%= f.text_field :author,:size=>"10" %>
    </div>
  </div>

  <div class="field">
    <%= f.label "标题" %><br />
    <%= f.text_field :title,:size=>"100" %>
  </div>
  <div class="field">
    <%= f.label "正文" %><br />
    <%= f.cktext_area :content,
      :toolbar => 'Full',
      :width => 800,
      :height => 400,
      :language => 'zh-cn',
      :filebrowserBrowseUrl => "/ckeditor/attachment_files",
      :filebrowserUploadUrl => "/ckeditor/attachment_files",
      :filebrowserImageBrowseUrl => "/ckeditor/pictures",
      :filebrowserImageUploadUrl => "/ckeditor/pictures"
  %>
  </div>


  <div class="actions">
    <%= f.submit "确定" %>
  </div>
<% end %>
